<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="PC/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" href="PC/css/bussit.css">
</head>
<body>
	<div class="bus_box">
		<div class="bus_msg">
			<a target="rightFrame" href="/useman?test">
				<div class="msg_img fl">
					<img src="PC/images/laba.svg">
				</div>
				<div class="msg_text fl">
					<p>
						消息通知：&nbsp;&nbsp;您有<em id="exp_num">*</em>个客户即将到期
					</p>
				</div>
			</a>
		</div>
		<div class="bus_summary">
			<div class="sum_box_f sbf_header" style="margin-left: 0%;">
				<div class="sbf_boxl fl">
					<h4>今日新开账号</h4>
					<div class="imgbox_90_1">
						<img src="PC/images/bs_img1.png">
					</div>
				</div>
				<div class="sbf_boxr fl">
					<span style="color:#43ca47"><en id="dai_acc_num">0</en></span>
				</div>
			</div>
			<div class="sum_box_f"  style="margin-left: 25.3%;">
				<div class="sbf_boxl fl">
					<h4>今日进账</h4>
					<div class="imgbox_90_2">
						<img src="PC/images/bs_img2.png">
					</div>
				</div>
				<div class="sbf_boxr fl">
					<span style="color:#f1d341"><em id="daliy_income">0</em>元</span>
				</div>
			</div>
			<div class="sum_box_f"  style="margin-left: 50.6%;">
				<div class="sbf_boxl fl">
					<h4>本月新开账号</h4>
					<div class="imgbox_90_3">
						<img src="PC/images/bs_img3.png">
					</div>
				</div>
				<div class="sbf_boxr fl">
					<span style="color:#8b4bf3"><em id="mon_account_num">0</em></span>
				</div>
			</div>
			<div class="sum_box_f"  style="margin-left: 75.9%;">
				<div class="sbf_boxl fl">
					<h4>本月累计销售</h4>
					<div class="imgbox_90_4">
						<img src="PC/images/bs_img4.png">
					</div>
				</div>
				<div class="sbf_boxr fl">
					<span style="color:#ff4b4b"><em id="month_income">0</em>元</span>
				</div>
			</div>
		</div>
		<div class="bus_main">
			<div class="mai_list">
				<table id="table" class="table table-striped table-hover table-bordered">
					<thead style="">
						<tr>
							<p></p>
							<h4 class="fwqlb">服务器列表</h4>
								<div class="input-group">
									<input type="text" id="cx_lb_text" max="18" class="form-control">
									<span class="input-group-btn">
										<button class="btn btn-default" id="btn_cx_lb" type="button">
											<img src="PC/images/fdj.svg" width="13" height="13">
										</button>
									</span>
								</div>
							<hr class="TableHr">
						</tr>
						<tr>
							<th style="width: 20%;">省份</th>
							<th style="width: 19.89%;">地区</th>
							<th style="width: 19.94%;">运营商</th>
							<th style="width: 19.8%;">服务器</th>
							<th style="width: 19.85%;">状态</th>
						</tr>
					</thead>
					<tbody id="tbod_li">
					</tbody>
				</table>
			</div>
			<div class="mai_guild">
				<h4 class="fwqlb">快速通道</h4>
				<hr class="TableHr">
				<div class="gui_f" id="GFonA">
					<div class="">
						<img  src="PC/images/img1_black.png" class="gfona1">
						<img src="PC/images/img1_white.png" class="gfona2">
					</div>
					<h5>快速开通基础测试账号<span>（一天使用时长）</span></h5>
				</div>
				<div class="gui_f" id="GFonB">
					<div class="">
						<img src="PC/images/img2_black.png" class="gfonb1">
						<img src="PC/images/img2_white.png" class="gfonb2">
					</div>
					<h5>快速开通周卡套餐账号<span>（默认基础套餐）</span></h5>
				</div>
				<div class="gui_f" id="GFonC">
					<div class="">
						<img src="PC/images/img1_black.png" class="gfonc1">
						<img src="PC/images/img1_white.png" class="gfonc2">
					</div>
					<h5>快速开通高级测试账号<span>（一天使用时长）</span></h5>
				</div>
				<div class="gui_f" id="GFonD">
					<div class="">
						<img src="PC/images/img4_black.png" class="gfond1">
						<img src="PC/images/img4_white.png" class="gfond2">
					</div>
					<h5>快速开通月卡套餐账号<span>（默认基础套餐）</span></h5>
				</div>
				<a href="../html/account_information.html">
					<div class="gui_f">
						<div class="gfone">
							<img src="PC/images/img3_black.png" class="gfone1">
							<img src="PC/images/img3_white.png" class="gfone2">
						</div>
						<h5>快速充值入口<span>（支持多种支付方式）</span></h5>
					</div>
				</a>
				<input type="hidden" id="_token" name="_token" value="{{ csrf_token() }}">
			</div>
		</div>
	</div>



<script type="text/javascript" src="PC/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="PC/js/vue.min.js"></script>
<script type="text/javascript" src="PC/js/bussit.js"></script>

<script>
$(document).ready(function(){

	function Ajax_Index(){
		$.ajax({//帐户信息获取填充 begin
			type:"get",
			url:"/getIndexInfo",
			success:function(data){
				// console.log(data.error_code);
				var err_cod = data.error_code;
				if (err_cod == 0){
					$("#exp_num").text(data.data.expire_num);
					$("#dai_acc_num").text(data.data.daily_account_num);
					$("#daliy_income").text(data.data.daliy_income);
					$("#mon_account_num").text(data.data.mon_account_num);
					$("#month_income").text(data.data.month_income);



				}else{alert("老铁，你怕是断网了吧？")}
			}
		});//帐户信息获取填充 end
	}

	Ajax_Index();


	$.ajax({//服务器列表生成遍历 begin
		type:"get",
		url:"/getAreaList",
		dataType:"json",
		success:function(data){
			// console.log(data.data);
			num = data.data.count;
			var html = "";
			if(data.data.count != 0 ){
				$.each(data.data.data,function(i,value){
					html+=`
					<tr class="a1">
					<td>${value['province']}</td>
					<td>${value['city']} </td>
					<td>${value['carrieroperator']}</td>
					<td>${value['ip']}</td>
					<td>${value['enable_flag']}</td>
					</tr>
					`;
					$("#tbod_li").html(html);
				});
			}
		}
	});//服务器列表生成遍历 end

	$("#btn_cx_lb").click(function(){
        // count
		var region = $("#cx_lb_text").val();
		data = {
			"region":region,
		}
		console.log(data)
		$.ajax({//服务器列表生成遍历 begin
			type:"get",
			url:"/getAreaList",
			data:data,
			dataType:"json",
			success:function(data){
                $("#btn_cx_lb").attr('disabled',false)
				console.log(data.data);
				num = data.data.count;

				var html = "";
				if(data.data.count != 0 ){
					$.each(data.data.data,function(i,value){
						html+=`
						<tr class="a1">
						<td>${value['province']}</td>
						<td>${value['city']} </td>
						<td>${value['carrieroperator']}</td>
						<td>${value['ip']}</td>
						<td>${value['enable_flag']}</td>
						</tr>
						`;
						$("#tbod_li").html(html);
					});
				}
			}
		});//服务器列表生成遍历 end
	})


	$(function(){
		var day = 8;
		var week = 25;
		var month = 50;
		var token = $('#_token').val();

		$('#GFonA').click(function(){
			if(confirm('开通基础套餐测试账号,有效期为一天,请尽快续费')) {
				$.ajax({
					url: '/QuickOpenTestAccount',
					type: 'post',
					data: {
						set_meal_type:2,
						_token:token
					},
					timeout: 5000,
					dataType: 'json',
					success: function (data, textStatus, jqXHR) {
						if (data.error_code == 0) {
							if (data.error_code == '0') {
								alert('添加成功');
								Ajax_Index();
							}
						} else {
							alert(data.error_message);
						}
					},
					error: function (xhr, textStatus) {
						alert('失败！');
					}
				})
			}
		});
		$('#GFonC').on('click',function(){
			if(confirm('开通高级套餐测试账号,有效期为一天,请尽快续费')) {
				$.ajax({
					url: '/QuickOpenTestAccount',
					type: 'post',
					timeout: 5000,
					data: {
						set_meal_type:3,
						_token:token
					},
					dataType: 'json',
					success: function (data, textStatus, jqXHR) {
						if (data.error_code == 0) {
							if (data.error_code == '0') {
								alert('添加成功');
								Ajax_Index();
							}
						} else {
							alert(data.error_message);
						}
					},
					error: function (xhr, textStatus) {
						alert('失败！');
					}
				})
			}
		});

		$('#GFonB').on('click',function(){
			if(confirm('开通基础套餐周卡账号,有效期为7天,请尽快续费 ' + '￥:'+ week*1+'.00')) {
				$.ajax({
					url: '/QuickOpenPayAccount',
					type: 'post',
					timeout: 5000,
					data: {
						// type: 1,
						// concent_num: 1,
						// date: 1,
						date_type: '周',
						price: week*1,
						set_meal_type:2,
						_token:token
					},
					dataType: 'json',
					success: function (data, textStatus, jqXHR) {
						if (data.error_code == 0) {
							if (data.error_code == '0') {
								alert('添加成功');
								Ajax_Index();
							}
						} else {
							layer.msg(data.error_message);
						}
					},
					error: function (xhr, textStatus) {
						alert('失败！');
					}
				})
			}
		});

		$('#GFonD').on('click',function(){
			if(confirm('开通基础套餐月卡账号,有效期为30天 ' + '￥:'+ month*1+'.00')) {
				$.ajax({
					url: '/QuickOpenPayAccount',
					type: 'post',
					timeout: 5000,
					data: {
						// type: 1,
						// concent_num: 1,
						// date: 1,
						date_type: '月',
						price: month*1,
						set_meal_type:2,
						_token:token
					},
					dataType: 'json',
					success: function (data, textStatus, jqXHR) {
						if (data.error_code == 0) {
							if (data.error_code == '0') {
								alert('添加成功');
								Ajax_Index();
							}
						} else {
							layer.msg(data.error_message);
						}
					},
					error: function (xhr, textStatus) {
						alert('失败！');
					}
				})

			}
		});

	})
});
</script>
</body>
</html>